package pers.wq.model.bean;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

import pers.wq.controller.BaseIndexAction;
import pers.wq.model.MajorModel;
import pers.wq.model.SelectMajorModel;
import pers.wq.util.TagManager;

public class SelectMajor extends BaseBean{
	private int smid;
	private Student student;
	private Major major;
	private int weight;
	private int state;
	private static Map<String,String> map = new HashMap();
	
	static {
		map.put("0", "不同意");
		map.put("1", "同意");
	}
	
	@Override
	public Map<String, String> tagMap() {
		// TODO Auto-generated method stub
		Map<String,String> reMap = new LinkedHashMap<String,String>();
		if(getId() != 0){
			reMap.put(TAG_HIDDEN,TagManager.inputHidden("selectMajor.id", getId()+""));
		}
		reMap.put("学生ID", TagManager.inputTextDisable("selectMajor.student.id", student.getId()+"") + TagManager.inputHidden("selectMajor.student.id", student.getId()+""));
		reMap.put("学生姓名", TagManager.inputTextDisable("selectMajor.student.sname",student.getSname()) + TagManager.inputHidden("selectMajor.student.sname",student.getSname()));
		reMap.put("专业名",TagManager.inputTextDisable("selectMajor.major.mname",major.getMname()) + TagManager.inputHidden("selectMajor.major.mid",major.getMid()));
		reMap.put("权值", TagManager.inputTextDisable("selectMajor.weight",this.getWeight()+"") + TagManager.inputHidden("selectMajor.weight",this.getWeight()+""));
		reMap.put("状态", TagManager.selectTag("selectMajor.state", this.state + "", map));
		return reMap;
	}
	
	@Override
	public Map<String, String> tagMap4Stu() {
		// TODO Auto-generated method stub
		Map<String,String> reMap = new LinkedHashMap<String,String>();
		if(getId() != 0){
			reMap.put(TAG_HIDDEN,TagManager.inputHidden("selectMajor.id", getId()+""));
		}
		String id = BaseIndexAction.getSession(BaseIndexAction.ID_TAG);
		reMap.put("学生ID", TagManager.inputTextDisable("selectMajor.student.id", id) + TagManager.inputHidden("selectMajor.student.id", id));
		MajorModel mm = new MajorModel();
		Map<String,String> map = mm.getAllCollegeMap("mid", "mname");
		String defaultKey = major==null?null:major.getMid()==null?null:major.getMid();
		reMap.put("专业", TagManager.selectTag("selectMajor.major.mid", defaultKey, map));
		SelectMajorModel smm = new SelectMajorModel();
		String weight = smm.getNowWeight(id);
		reMap.put("权值", TagManager.inputTextDisable("selectMajor.weight", weight) + TagManager.inputHidden("selectMajor.weight", weight));
		reMap.put("是否同意", TagManager.inputTextDisable("selectMajor.state", this.state + "") + TagManager.inputHidden("selectMajor.state", this.state + ""));
		return reMap;
	}
	
	@Override
	public void setId(int id) {
		// TODO Auto-generated method stub
		this.smid = id;
	}
	@Override
	public int getId() {
		// TODO Auto-generated method stub
		return this.smid;
	}
	public int getSmid() {
		return smid;
	}
	public void setSmid(int smid) {
		this.smid = smid;
	}
	public int getWeight() {
		return weight;
	}
	public void setWeight(int weight) {
		this.weight = weight;
	}
	public Student getStudent() {
		return student;
	}
	public void setStudent(Student student) {
		this.student = student;
	}
	public Major getMajor() {
		return major;
	}
	public void setMajor(Major major) {
		this.major = major;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
}
